package com.shujia.controller;

import com.shujia.service.UserService;
import com.shujia.service.UserServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    private UserService userService = new UserServiceImpl();

    /**
     * http://localhost:8080/login?username=zhangsan&password=aaa
     */
    @GetMapping("/login")
    public String login(String username, String password) {
        String login = userService.login(username, password);
        return login;
    }

    /**
     *
     * http://localhost:8080/register?username=wangwu&password=123&nowPassword=123
     *
     */

    @GetMapping("/register")
    public String register(String username, String password, String nowPassword) {

        String register = userService.register(username, password, nowPassword);
        return register;
    }

}
